package com.lmj.controller;

import com.lmj.dto.DataResponse;
import com.lmj.service.CurDictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/curDictionary")
public class CurDictionaryController {

    @Autowired
    private CurDictionaryService curDictionaryService;

    // 设置当前学习词典的学习位置为1，把之前学习的词典的学习位置为0
    @RequestMapping("/set_cur")
    public DataResponse setCurDictionary(@RequestBody String request) {
        return curDictionaryService.setCurDictionary(request);
    }

    // 获取当前正在学习的词典（学习位为1的词典）
    @RequestMapping("/get_cur")
    public DataResponse getCurDictionary(@RequestBody String request) {
        return curDictionaryService.getCurDictionary(request);
    }

    // 设置更新当前学习词典的curStudiedWords
    @RequestMapping("/update_cur")
    public DataResponse updateCurStudiedWords(@RequestBody String request) {
        return curDictionaryService.updateCurStudiedWords(request);
    }

    // 获取当前用户学习过的所有单词
    @RequestMapping("get_totalwords")
    public  DataResponse getTotalWords(@RequestBody String request) {
        return curDictionaryService.getTotalWords(request);
    }

}
